package com.bg.zk.config;

import org.apache.zookeeper.KeeperException;

import java.io.UnsupportedEncodingException;
import java.util.Map;

/**
 * @Auther: zhengshunzhi
 * @Date: 2018/12/20 14:03
 * @Description:
 */
public interface ZkConfig {

    /**
     * 添加配置
     *
     * @param key
     * @param value
     */
    String add(String key, String value) throws KeeperException, InterruptedException, UnsupportedEncodingException;

    /**
     * 更新配置
     *
     * @param key
     * @param value
     */
    boolean update(String key, String value) throws KeeperException, InterruptedException;

    /**
     * 删除配置
     *
     * @param key
     */
    void delete(String key) throws KeeperException, InterruptedException;

    /**
     * 获取配置
     *
     * @param key
     * @return
     */
    String getKey(String key) throws KeeperException, InterruptedException;

    /**
     * 功能描述: key是否存在
     *
     * @param:
     */
    boolean exsitsKey(String key) throws KeeperException, InterruptedException;

    /**
     * 获取所有的配置内容
     *
     * @return
     */
    Map<String, String> getAll(String rootPath) throws KeeperException, InterruptedException;
}
